<?php

require_once('settings.inc.php');

function save_backup_file($name)
{
    // 1. file must be gz archive
    $file = gzopen($name,'r');

    if ($file === FALSE)
    {
        return FALSE;
    }

    // 2. and contain signature

    $sign = gzread($file, 1024);

    gzclose($file);

    global $path;

    $dst = '.' . $path . '/up_asud_'.date("Y-m-d_H-i").'.sql.gz';

    $one = isset($sign);
    $two = preg_match("/^#SKD101\|/", $sign);

    return ( $one && $two && move_uploaded_file($name, $dst));

}
?>